package main.Q2101_2200;

public class Q2141_2150 {
    public static void main(String[] args) {
        System.out.println("Question2141：");
        System.out.println("Question2142：");
        System.out.println("Question2143：");
        System.out.println("Question2144：");
        System.out.println("Question2145：");
        System.out.println("Question2146：");
        System.out.println("Question2147：");
        System.out.println("Question2148：");
        System.out.println("Question2149：按符号重排数组");
        System.out.println("Question2150：");
    }
}

class Question2149 {
    public int[] rearrangeArray(int[] nums) {
        int[] result = new int[nums.length];
        int i = 0, j = 1;
        for (int k = 0; k < nums.length; k++) {
            if (nums[k] > 0) {
                result[i] = nums[k];
                i += 2;
            } else {
                result[j] = nums[k];
                j += 2;
            }
        }
        return result;
    }
}